// let uid = 0
/*
const baseKpiData = () => ({
    code: 10000,
    data: {
        total: 17,
        pages: 1,
        pageNo: 2,
        pageSize: 10,
        rows: [
            {
                id: '11',
                idNo: '860001',
                name: `张三${uid}`,
                status: '状态',
                department: 'VV LIFE 研发部',
                team: '开发一组',
                period: '2020-06',
                type: '季度绩效奖',
                coefficient: '1',
                remark: '请事假20天'
            },
            {
                id: '12',
                idNo: '860002',
                name: `李四${uid}`,
                status: '状态',
                department: 'VV LIFE 研发部',
                team: '开发一组',
                period: '2020-06',
                type: '季度绩效奖',
                coefficient: '1.2',
                remark: '请事假20天'
            },
            {
                id: '13',
                idNo: '860003',
                name: `王五${uid}`,
                status: '状态',
                department: 'VV LIFE 研发部',
                team: '开发一组',
                period: '2020-06',
                type: '季度绩效奖',
                coefficient: '0.5',
                remark: '请事假20天'
            },
            {
                id: '14',
                idNo: '860004',
                name: `丁六${uid}`,
                status: '状态',
                department: 'VV LIFE 研发部',
                team: '开发一组',
                period: '2020-06',
                type: '季度绩效奖',
                coefficient: '0.8',
                remark: '请事假20天'
            },
            {
                id: '15',
                idNo: '860005',
                name: `赵七${uid}`,
                status: '状态',
                department: 'VV LIFE 研发部',
                team: '开发一组',
                period: '2020-06',
                type: '季度绩效奖',
                coefficient: '1',
                remark: '请事假20天'
            },
            {
                id: '16',
                idNo: '860006',
                name: `陈陈${uid}`,
                status: '状态',
                department: 'VV LIFE 研发部',
                team: '开发一组',
                period: '2020-06',
                type: '季度绩效奖',
                coefficient: '1',
                remark: '请事假20天'
            },
            {
                id: '17',
                idNo: '860007',
                name: `林九${uid}`,
                status: '状态',
                department: 'VV LIFE 研发部',
                team: '开发一组',
                period: '2020-06',
                type: '季度绩效奖',
                coefficient: '1',
                remark: '请事假20天'
            }
        ]
    }
})
*/

const progressBar = () => ({
    code: 10000,
    data: [
        {
            type: 1,
            status: 2,
            total: 100,
            failed: 20
        },
        {
            type: 2,
            status: 3,
            total: 100,
            reviewed: 100
        },
        {
            type: 3,
            status: 2,
            total: 100,
            reviewed: 80
        },
        {
            type: 4,
            status: 2,
            total: 100,
            reviewed: 20
        },
        {
            type: 5,
            status: 3,
            total: 100,
            confirmed: 80,
            feedback: 5,
            unconfirmed: 15
        },
        {
            type: 6,
            status: 3,
            approveSubmitTime: new Date().getTime(),
            approveCompleteTime: new Date().getTime()
        },
        {
            type: 7,
            status: 2,
            applySubmitTime: new Date().getTime()
        },
        {
            type: 8,
            status: 2,
            payTime: new Date().getTime()
        }
    ]
});

const getHrCheckButtons = () => ({
    code: 10000,
    data: [
        {
            code: 2,
            name: '提醒细项复核',
            disabled: true
        },
        {
            code: 3,
            name: '提交审批流',
            disabled: true
        },
        {
            code: 4,
            name: '下发薪资条',
            disabled: false
        },
        {
            code: 5,
            name: '申请付款',
            disabled: true
        },
        {
            code: 6,
            name: '批量复核通过',
            disabled: false
        },
        {
            code: 1,
            name: '更新数据',
            disabled: true
        },
        {
            code: 7,
            name: 'Excel导出',
            disabled: false
        }
    ]
});

const queryRecheckHrTableHead = () => ({
    code: 10000,
    data: [
        {
            title: '姓名',
            dataIndex: 'employeeName',
            sortable: true
        },

        {
            title: '工号',
            dataIndex: 'employeeNo'
        },

        {
            title: '部门',
            dataIndex: 'departmentName'
        },

        {
            title: '职位',
            dataIndex: 'positionName'
        },

        {
            title: '职级',
            dataIndex: 'rankName'
        },

        {
            title: '薪资总额',
            dataIndex: 'encryptTotalAmt',
            // 数值型
            columnType: 2
        },
        {
            title: '实发薪资',
            dataIndex: 'encryptTotalPayAmt',
            // 数值型
            columnType: 2,
            sortable: true
        },
        {
            title: '固定薪资',
            dataIndex: 'fixedSalary',
            children: [
                {
                    title: '基本月薪',
                    dataIndex: 'asdfs'
                }
            ]
        },

        {
            title: '绩效薪资',
            children: [
                {
                    title: '季度绩效奖',
                    dataIndex: 'quarterAwardAmt',
                    // 整型
                    columnType: 1
                },
                {
                    title: '半年奖',
                    dataIndex: 'halfYearAwardAmt',
                    // 数值型
                    columnType: 2
                },
                {
                    title: '年终奖',
                    dataIndex: 'yearAwardAmt',
                    // 数值型
                    columnType: 2
                }
            ]
        },
        {
            title: '工资项1',
            dataIndex: 'k1',
            colorControl: 1
        },
        {
            title: 'HR复核',
            dataIndex: 'hrCheckStatusName'
        },
        {
            title: '财务复核',
            dataIndex: 'financeCheckStatusName'
        }
    ]
});

const queryRecheckHrTableData = () => ({
    code: 10000,
    data: {
        total: 17,
        pages: 1,
        pageNo: 2,
        pageSize: 10,
        rows: [
            {
                id: '11',
                employeeNo: '860001',
                employeeName: '张三',
                departmentName: 'VV LIFE 研发部',
                positionName: '工程师',
                rankName: 'P5',
                encryptTotalAmt: 1000,
                encryptTotalPayAmt: 800,
                quarterAwardAmt: 800,
                halfYearAwardAmt: 800,
                yearAwardAmt: -900,
                dynamicSalaryPayrollInfo: {
                    k1: 899
                },
                hrCheckStatusName: '已驳回',
                hrCheckStatus: 2,
                hrRemark: 'xxxxxxxxxxxxxxx',
                financeCheckStatusName: '已驳回',
                financeCheckStatus: 2
            },
            {
                id: '12',
                employeeNo: '860002',
                employeeName: '李四',
                departmentName: 'VV LIFE 研发部',
                positionName: '工程师',
                rankName: 'P5',
                encryptTotalAmt: 1000,
                encryptTotalPayAmt: 700,
                quarterAwardAmt: 800,
                halfYearAwardAmt: 800,
                yearAwardAmt: 900,
                dynamicSalaryPayrollInfo: {
                    k1: 899
                },
                hrCheckStatusName: '已复核',
                hrCheckStatus: 1,
                financeCheckStatusName: '已复核',
                financeCheckStatus: 1
            },
            {
                id: '13',
                employeeNo: '860003',
                employeeName: '王五',
                departmentName: 'VV LIFE 研发部',
                positionName: '工程师',
                rankName: 'P5',
                encryptTotalAmt: 1000,
                encryptTotalPayAmt: 600,
                quarterAwardAmt: 800,
                halfYearAwardAmt: 800,
                yearAwardAmt: 900,
                dynamicSalaryPayrollInfo: {
                    k1: 899
                },
                hrCheckStatusName: '未复核',
                hrCheckStatus: 0,
                financeCheckStatusName: '未复核',
                financeCheckStatus: 0
            },
            {
                id: '14',
                employeeNo: '860004',
                employeeName: '丁六',
                departmentName: 'VV LIFE 研发部',
                positionName: '工程师',
                rankName: 'P5',
                encryptTotalAmt: 1000,
                encryptTotalPayAmt: 950,
                quarterAwardAmt: 800,
                halfYearAwardAmt: 800,
                yearAwardAmt: 900,
                dynamicSalaryPayrollInfo: {
                    k1: 899
                }
            },
            {
                id: '15',
                employeeNo: '860005',
                employeeName: '赵七',
                status: '状态',
                departmentName: 'VV LIFE 研发部',
                positionName: '工程师',
                rankName: 'P5',
                encryptTotalAmt: 1000,
                encryptTotalPayAmt: 960,
                quarterAwardAmt: 800,
                halfYearAwardAmt: 800,
                yearAwardAmt: 900,
                dynamicSalaryPayrollInfo: {
                    k1: 899
                }
            },
            {
                id: '16',
                employeeNo: '860006',
                employeeName: '陈陈',
                status: '状态',
                departmentName: 'VV LIFE 研发部',
                positionName: 'xx',
                rankName: 'P5',
                encryptTotalAmt: 1000,
                encryptTotalPayAmt: 800,
                quarterAwardAmt: 800,
                halfYearAwardAmt: 800,
                yearAwardAmt: 900,
                dynamicSalaryPayrollInfo: {
                    k1: 899
                }
            },
            {
                id: '17',
                employeeNo: '860007',
                employeeName: '林九',
                status: '状态',
                departmentName: 'VV LIFE 研发部',
                positionName: '工程师',
                rankName: 'P5',
                encryptTotalAmt: 1000,
                encryptTotalPayAmt: 800,
                quarterAwardAmt: 800,
                halfYearAwardAmt: 800,
                yearAwardAmt: 900,
                dynamicSalaryPayrollInfo: {
                    k1: 899
                }
            }
        ]
    }
});

const getSalaryPayrollItems = () => ({
    code: 10000,
    data: [
        { payrollId: '1', salaryItemId: '1', salaryItemName: '绩效薪资-年底绩效奖' },
        { payrollId: '1', salaryItemId: '2', salaryItemName: '补贴薪资-加班餐补' },
        { payrollId: '1', salaryItemId: '3', salaryItemName: '其他应税收入' }
    ]
});

const rejectSalaryPayrollItems = () => ({
    code: 10000
});

const itemRecheckService = {
    getTableHeaderItems: () => ({
        code: 10000,
        data: [
            {
                title: '员工基础信息',
                dataIndex: 'employeeBaseInfo',
                sortable: true,
                children: [
                    {
                        title: '工号',
                        dataIndex: 'employeeNo'
                    },
                    {
                        title: '姓名',
                        dataIndex: 'employeeName'
                    },
                    {
                        title: '部门',
                        dataIndex: 'depart'
                    },
                    {
                        title: '职位',
                        dataIndex: 'position'
                    }
                ]
            },

            {
                title: '补贴薪资类型',
                dataIndex: 'type'
            },

            {
                title: '绩效金额',
                dataIndex: 'performanceAmt'
            },

            {
                title: '基本月薪',
                dataIndex: 'basicAmt'
            },
            {
                title: '绩效系数',
                dataIndex: 'performanceCoefficient'
            },
            {
                title: '考勤系数',
                dataIndex: 'attendanceFactor'
            }
        ]
    }),

    queryTableBodyData: () => ({
        code: 10000,
        data: {
            total: 17,
            pages: 1,
            pageNo: 2,
            pageSize: 10,
            rows: [
                {
                    employeeNo: '860001',
                    employeeName: '张三',
                    depart: 'VV LIFE 研发部',
                    position: '工程师',

                    payrollItemList: [
                        {
                            type: '季度绩效奖',
                            performanceAmt: 3000,
                            basicAmt: 1000,
                            performanceCoefficient: 1.0,
                            attendanceFactor: 1.0
                        },
                        {
                            type: '半年奖',
                            performanceAmt: 10000,
                            basicAmt: 2000,
                            performanceCoefficient: 0.9,
                            attendanceFactor: 0.8
                        },
                        {
                            type: '年终奖',
                            performanceAmt: 11000,
                            basicAmt: 1000,
                            performanceCoefficient: 1.0,
                            attendanceFactor: 0.8
                        }
                    ]
                },
                {
                    employeeNo: '860004',
                    employeeName: '丁六',
                    depart: 'VV LIFE 研发部',
                    position: '工程师',

                    payrollItemList: [
                        {
                            type: '年终奖',
                            performanceAmt: 11000,
                            basicAmt: 1000,
                            performanceCoefficient: 1.0,
                            attendanceFactor: 0.8
                        }
                    ]
                }
            ]
        }
    }),

    getItemMenus: () => ({
        code: 10000,
        data: [
            {
                id: '01',
                itemName: '绩效薪资'
            },
            {
                id: '02',
                itemName: '补贴薪资'
            },
            {
                id: '03',
                itemName: '个人所得税'
            }
        ]
    })
};

const salaryPayOff = {
    getPayoffState: () => ({
        code: 10000,
        data: false
    }),

    doPayoff: () => ({
        code: 10000,
        data: true
    }),

    getExportInfo: () => ({
        code: 10000,
        data: {
            payoffState: false,
            fileName: '',
            description: '',
            remark: ''
        }
    })
};

const salaryTemplateLog = () => ({
    code: 10000,
    data: {
        total: 17,
        pages: 1,
        pageNo: 1,
        pageSize: 10,
        rows: [
            {
                id: '11',
                period: '2020-10',
                time: '2020-10-21  17:00:06',
                operator: '张三（860001）',
                type: '添加',
                content: '员工基础信息',
                description: '添加【入职日期】'
            },
            {
                id: '12',
                period: '2020-10',
                time: '2020-10-21  17:00:06',
                operator: '李四（860002）',
                type: '移除',
                content: '员工基础信息',
                description: '移除【入职日期】'
            },
            {
                id: '13',
                period: '2020-10',
                time: '2020-10-19  17:00:06',
                operator: '王五（860003）',
                type: '添加',
                content: '薪资要素',
                description: '添加【绩效薪资-季度绩效奖'
            },
            {
                id: '14',
                period: '2020-10',
                time: '2020-10-21  17:00:06',
                operator: '李静静（860121）',
                type: '移除',
                content: '薪资要素',
                description: '移除【绩效薪资-季度绩效奖】'
            }
        ]
    }
});

const salaryCalculateMock = {
    // 支持值为 Object 和 Array
    // 'POST /api/finance/salary/v1/salaryBaseKpi/queryByPage/*/* ': (req, res) => {
    //     uid += 1
    //     res.json(baseKpiData())
    // },

    'GET x/api/finance/salary/recheck/progressbar/*/*': (req, res) => {
        res.json(progressBar());
    },

    'GET x/api/finance/salary/hrRecheck/getHrCheckButtons/*/*': (req, res) => {
        res.json(getHrCheckButtons());
    },

    'POST x/api/finance/salary/recheck/tableHeaderItem/*/*': (req, res) => {
        res.json(queryRecheckHrTableHead());
    },

    'POST x/api/finance/salary/recheck/querySalaryPayroll': (req, res) => {
        res.json(queryRecheckHrTableData());
    },

    'GET x/api/finance/salary/recheck/getSalaryPayrollItems/*': (req, res) => {
        res.json(getSalaryPayrollItems());
    },

    'POST x/api/finance/salary/recheck/rejectSalaryPayrollItems/*': (req, res) => {
        res.json(rejectSalaryPayrollItems());
    },

    // 以下是绩效薪资
    'GET x/api/finance/salary/itemRecheck/getTableHeaderItems/*/*/*': (req, res) => {
        res.json(itemRecheckService.getTableHeaderItems());
    },

    'POST x/api/finance/salary/itemRecheck/getTableRecords': (req, res) => {
        res.json(itemRecheckService.queryTableBodyData());
    },

    'POST x/api/finance/salary/grant/executePay/*/*': (req, res) => {
        res.json(salaryPayOff.doPayoff());
    },

    'POST x/api/finance/salary/grant/getExportInfo/*/*': (req, res) => {
        res.json(salaryPayOff.getExportInfo());
    },

    'GET x/api/finance/salary/grant/getTableHeaderItems/*/*': (req, res) => {
        res.json(queryRecheckHrTableHead());
    },

    'POST x/api/finance/salary/grant/getTableRecords': (req, res) => {
        res.json(queryRecheckHrTableData());
    },

    'GET x/api/finance/salary/recheck/latestSalaryYearMonth': (req, res) => {
        res.json({ code: 10000, data: { year: 2020, month: 8 } });
    },

    'POST x/api/finance/salary/v1/log/querySysOperateLog': (req, res) => {
        res.json(salaryTemplateLog());
    }
};

export default salaryCalculateMock;
